import type {BaseRsp, ListData, PageParamsType} from "@/api/index";
import {useAxios} from "@/api/index";

// 查询广告
export interface AdvertListRsp {
    id: number
    created_at: Date
    title: string
    href: string
    image: string
    is_show: boolean
}

export function advertListAxios(params: PageParamsType): Promise<BaseRsp<ListData<AdvertListRsp>>> {
    return useAxios.get("/admin/advert/list", {params})
}

// 添加广告
export interface AdvertAddReq {
    title: string
    href: string
    image: string
    is_show: boolean
}

export function advertAddAxios(params: AdvertAddReq): Promise<BaseRsp<boolean>> {
    return useAxios.post("/admin/advert/add", params)
}
